package com.xinyi;
/**
 * @desc:
 * @author: Shoko
 * @date: 2025/4/22
 */
// 适配器类
public class OperationAdapter implements DataOperation {
    private QuickSort quickSort;
    private BinarySearch binarySearch;

    public OperationAdapter() {
        this.quickSort = new QuickSort();
        this.binarySearch = new BinarySearch();
    }

    @Override
    public void Sort(int[] arr) {
        quickSort.quickSort(arr); // 委托给QuickSort
    }

    @Override
    public int Search(int[] arr, int target) {
        return binarySearch.binarySearch(arr, target); // 委托给BinarySearch
    }
}
